﻿using System;
using System.Text;
using System.Drawing;
using System.Collections.Generic;

namespace Ex03.VehicalsObjectModel
{
    public class FuleCar : PrivateCar, IFuleVehical
    {
        // Members
        private const float k_FuleTankCapacity = 50F;
        private const eFuleType k_FuleTankType = eFuleType.Octane98;
        private FuleEnergySystem m_FuleEnergySystem;

        // Ctor

        /// <summary>
        /// Creates a new fule based car object
        /// </summary>
        /// <param name="i_LicenseNumber">The license number of the car</param>
        /// <param name="i_CarColor">The color of the car</param>
        /// <param name="i_NumOfDoors">The number of doors on the car</param>
        /// <exception cref="FormatException">When the license number is malformed</exception>
        /// <exception cref="ArgumentException">Too small number of doors</exception>
        internal FuleCar(
            string i_LicenseNumber, 
            Color i_CarColor,
            int i_NumOfDoors) : 
                base(i_LicenseNumber, new FuleEnergySystem(k_FuleTankType, k_FuleTankCapacity), i_CarColor, i_NumOfDoors)
            {
                m_FuleEnergySystem = m_EnergySystem as FuleEnergySystem;
            }

        #region IFuleVehical Members

        /// <summary>
        /// Fules the system with a given amount of a certain fule type
        /// </summary>
        /// <param name="i_FuleType">The type of fule</param>
        /// <param name="i_AddedLitteres">The amount of fule to add</param>
        /// <exception cref="ArgumentException">When the fule type doesnt match the system's</exception>
        /// <exception cref="ValueOutOfRangeException">When the fule amount is negative or exceeds the capacity of the system</exception>
        public void Fule(eFuleType i_FuleType, float i_AddedLitters)
        {
            m_FuleEnergySystem.Fule(i_FuleType, i_AddedLitters);
        }

        /// <summary>
        /// Gets the current amount of fule litteres in the tank
        /// </summary>
        public float CurrentLitteres
        {
            get
            {
                return m_FuleEnergySystem.CurrentFuleAmount;
            }
        }

        /// <summary>
        /// Gets the maximum litteres of fule the tank can hold
        /// </summary>
        public float MaximumLitteres
        {
            get
            {
                return m_FuleEnergySystem.MaxFuleAmount;
            }
        }

        /// <summary>
        /// Gets the fule type of the vehical
        /// </summary>
        public eFuleType FuleType
        {
            get
            {
                return m_FuleEnergySystem.FuleType;
            }
        }

        #endregion
    }
}
